
  var goods = [
              {   'id':'A1',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/1',
                    'iscur':false,
                     "numbel":123,
                     "goodsNew":'public/img/new.png'
              },
               {   'id':'A2',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/2',
                    'iscur':false,
                     "numbel":124,
                     "goodsNew":'public/img/new.png'
              },
               {   'id':'A3',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/3',
                    'iscur':false,
                     "numbel":126,
                     "goodsNew":'public/img/new.png'
              }, {   'id':'A4',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/1',
                    'iscur':false,
                     "numbel":127,
                     "goodsNew":'public/img/new.png'
              },
               {   'id':'A5',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/2',
                    'iscur':false,
                     "numbel":128,
                     "goodsNew":'public/img/new.png'
              },
               {   'id':'A6',
                   'goodsimg':'public/img/ronghao.png',
                   'goodsp':'2016/11/3',
                    'iscur':false,
                     "numbel":129,
                     "goodsNew":'public/img/new.png'
              }
        ];
new Vue({
  // created:function(){
  //   alert()
  // },
    el:'#app',
    data:{
        goods:goods,
        isdisplay:true,
        ids:[],
        iswindbg:true,
        goods : goods,
        busy: false,
    },
    methods:{
        clicricle:function(index){
          this.goods[index].iscur = !this.goods[index].iscur;

          if(this.ids.indexOf(this.goods[index].id)>-1){
              this.ids.splice(this.ids.indexOf(this.goods[index].id),1);
          }else{
            this.ids.push(this.goods[index].id);
          }
         
      },
      clishou:function(){
           this.isdisplay=false;
      },
      close:function(){
           this.isdisplay=true;
      },
      delete:function(){
      
           // if(vm.data.goods){
           //            alert(1)
           // }else{
           //  alert('空')
           // }
           // console.log(this.goods)
           // 
           // 
           if(this.ids.length===0){
              return  alert('没有选择删除项');
           }else if(this.ids.length>0){
              return this.iswindbg=false;
            }          
      },
      //弹出弹框执行确定命令执行
      windclose:function(){
        return this.iswindbg=true;
      },
      confirm:function(){
          var self = this;
        this.goods = this.goods.filter(function(item){  //接着上面的，空数组存入的值，在进行清空，
            return self.ids.indexOf(item.id)  === -1; //没有选中的返回，也就是留下  

          });
           this.ids = []; //初始化 要不然会累积
           return self.iswindbg=true; 
      }
    }//方法结束
})



